import time

from machine import Pin, PWM

led = PWM(Pin(12), freq=200000, duty=0)
led2 = Pin(13, Pin.OUT)
temp = 0
while True:

    if temp == 1022:
        while temp:
            time.sleep_ms(5)
            temp -= 2
            led.duty(temp)
    else:
        time.sleep_ms(5)
        temp += 2
        led.duty(temp)
